package com.kumi.blog.article.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kumi.blog.article.bean.Categoryreferenced;
import com.kumi.blog.article.service.CategoryreferencedService;
import com.kumi.common.utils.PageUtils;
import com.kumi.common.utils.R;



/**
 * 文章分类 
 *
 * @author kumi
 * @email 1971240051@qq.com
 * @date 2022-06-04 03:23:06
 */
@RestController
@RequestMapping("article/categoryreferenced")
public class CategoryreferencedController {
    @Autowired
    private CategoryreferencedService categoryreferencedService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("article:categoryreferenced:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = categoryreferencedService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{crId}")
    //@RequiresPermissions("article:categoryreferenced:info")
    public R info(@PathVariable("crId") Integer crId){
		Categoryreferenced categoryreferenced = categoryreferencedService.getById(crId);

        return R.ok().put("categoryreferenced", categoryreferenced);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("article:categoryreferenced:save")
    public R save(@RequestBody Categoryreferenced categoryreferenced){
		categoryreferencedService.save(categoryreferenced);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("article:categoryreferenced:update")
    public R update(@RequestBody Categoryreferenced categoryreferenced){
		categoryreferencedService.updateById(categoryreferenced);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("article:categoryreferenced:delete")
    public R delete(@RequestBody Integer[] crIds){
		categoryreferencedService.removeByIds(Arrays.asList(crIds));

        return R.ok();
    }

}
